/*
 * @Author: your name
 * @Date: 2023-02-14 19:56:18
 * @LastEditTime: 2023-02-14 19:56:32
 * @LastEditors: DESKTOP-9S28988
 * @Description: In User Settings Edit
 * @FilePath: \back_end\src\utils\cryptojs.ts
 */
import CryptoJS from 'crypto-js'

//密钥
const pwdKey = '-mall4j-password'

//加密方法
export function addKeyPassword(password) {
  const time = Date.now()
  const key = CryptoJS.enc.Utf8.parse(pwdKey);
  let srcs = CryptoJS.enc.Utf8.parse(time + password)
  let encrypted = CryptoJS.AES.encrypt(srcs,key,{mode:CryptoJS.mode.ECB,padding:CryptoJS.pad.Pkcs7})
  return encrypted.toString()
}